<template>
  <f7-page>
    <f7-navbar :title="$t('settings.changePassword')" :back-link="$t('common.back')">

    </f7-navbar>
    <f7-block-title>{{$t('settings.changePassword')}}</f7-block-title>
    <f7-list form>
      <f7-list-item>
        <f7-label>{{$t("app.password")}}</f7-label>
        <f7-input type="text" :placeholder="$t('app.password')"  @input="user.password = $event.target.value"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>{{$t("register.confirmPassword")}}</f7-label>
        <f7-input type="text" :placeholder="$t('register.enterPasswordsAgain')"  @input="user.password2 = $event.target.value"></f7-input>
      </f7-list-item>



    </f7-list>

    <f7-block>
      <f7-row tag="p">
        <f7-button class="col"  fill raised color="blue" @click="handlerSave">{{$t('common.save')}}</f7-button>
      </f7-row>
    </f7-block>



  </f7-page>
</template>

<script>
import { updatePass } from '@/api/api';
export default {
  data() {
			return {
				user:{
          password:'',
          password2:''
        }
			}
		},
  methods:{
      handlerSave(){
        var _this = this;
        this.$f7.dialog.confirm('你确定修改密码?', function () {

              updatePass(_this.user).then(data=>{
                _this.$f7.toast.create({text: '密码修改成功',closeTimeout: 2000,}).open();
                _this.$f7.router.navigate('/')
                localStorage.clear();
                _this.$store.dispatch('exit');
              });
         });

      },
  },
  mounted() {
		},
  computed: {

		}
}
</script>
